import csv

#newline表示文件处理的时候不读或者不写换行
with open('01.csv','w',encoding='utf-8',newline='') as f:
    data = [
        ['aa','bb','cc','dd'],
        [1,2,3,4],
        [5,6,7,8],
        [2,3,2,1]
    ]
    writer = csv.writer(f)
    for d in data:
        # print(d)
        #执行writerow时会自动加一个换行，所以需要在读取文件的时候不读换行符
        writer.writerow(d)
